package org.helgoboss.commandlet_app

import org.helgoboss.commandlet._
import java.io.File

class AppExecutionContext(args: Array[String]) extends ExecutionContext {
    val workingDirectory = new File(System.getProperty("user.dir"))
    val arguments = args.toList
    val inputStream = System.in
    val outputStream = System.out
}

abstract class CommandletApp extends App {
    def commandlet: Commandlet    
    val executionContext = new AppExecutionContext(args)
    val exitCode = commandlet.execute(executionContext)
    System.exit(exitCode)
}